package com.cxh.rmsq.ui.adapter.self

import android.annotation.SuppressLint
import android.content.Intent
import android.graphics.Color
import android.text.Spannable
import android.text.SpannableString
import android.text.style.ForegroundColorSpan
import android.widget.TextView
import androidx.core.content.ContextCompat
import androidx.core.view.isVisible
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.module.LoadMoreModule
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.cxh.rmsq.R
import com.cxh.rmsq.db.model.ClueItemBean
import com.cxh.rmsq.ui.activity.self.LookUserDetailActivity2
import com.cxh.rmsq.ui.widget.GradientTextView
import com.cxh.rmsq.ui.widget.SelectableRoundedImageView
import com.cxh.rmsq.utils.loadImage


/**
 *
 */
class ClueListAdapter(type: Int) :
    BaseQuickAdapter<ClueItemBean, BaseViewHolder>(R.layout.item_clue_list),
    LoadMoreModule {

    init {
//        addChildClickViewIds(R.id.stv_focus)
    }

    var type = type  //1中高级价格  2初级
    private var mData = mutableListOf<String>() //图片

    @SuppressLint("ResourceType")
    override fun convert(holder: BaseViewHolder, item: ClueItemBean) {
        with(holder) {
            holder.getView<GradientTextView>(R.id.tv_content).setGradientColors(
                Color.parseColor("#FD9A3F"), Color.parseColor("#D93B0F")
            )

            setText(R.id.tv_name, item.productName)
            setText(R.id.tv_price, "￥" + item.productPrice)
            holder.getView<TextView>(R.id.tv_price)
                .setShadowLayer(4F, 2F, 2F, Color.parseColor("#FD9A3F"))
            loadImage(item.imgUrl, holder.getView<SelectableRoundedImageView>(R.id.siv_header))
            if (item.level == 2) {//初级
                setText(R.id.tv_level, "中级线索")
            } else if (item.level == 3) {//高级
                setText(R.id.tv_level, "高级线索")
            }else {

            }

        }
    }

}